<template>
	<view>
		<u-card padding="16" v-for="(item,index) in dataList" :key="index" >
			<view class="" slot="head">
				<view class="wrap">
					<u-row>
						<u-col span="12" text-align="left">
							<view class="weikaishi3">
								{{item.operateName}}
							</view>
						</u-col>
					</u-row>
					<u-row>
						<u-col span="12" text-align="left">
							<view class="jinxingzhong">
								<span>对账区间：{{item.startDt}} 至 {{item.endDt}}</span>
							</view>
						</u-col>
					</u-row>
					<u-row>
						<u-col span="6" text-align="left">
							<view class="weikaishi4">
								公里数：{{item.kilometerAll}}
							</view>
						</u-col>
						<u-col span="6" text-align="left">
							<view class="weikaishi4">
								总体积：{{item.sumVolAll}}
							</view>
						</u-col>
					</u-row>
					<u-row>
						<u-col span="6" text-align="left">
							<view class="weikaishi4">
								总数量：{{item.sumNumAll}}
							</view>
						</u-col>
						<u-col span="6" text-align="left">
							<view class="weikaishi4">
								其他补贴：{{item.otherSubsidieAll}}
							</view>
						</u-col>
					</u-row>
					<u-row>
						<u-col span="6" text-align="left">
							<view class="weikaishi4">
								运费：{{item.freightMoneyAll}}
							</view>
						</u-col>
						<u-col span="6" text-align="left">
							<view class="weikaishi4">
								装车费：{{item.loadingMoneyAll}}
							</view>
						</u-col>
					</u-row>
					<u-row>
						<u-col span="6" text-align="left">
							<view class="weikaishi4">
								客诉：{{item.custComplaintAll}}
							</view>
						</u-col>
						<u-col span="6" text-align="left">
							<view class="weikaishi4">
								其他罚款：{{item.otherFinesAll}}
							</view>
						</u-col>
					</u-row>
					<u-row>
						<u-col span="6" text-align="left">
							<view class="weikaishi4" style="color: red;">
								总费用：{{item.sumMoneyAll}}
							</view>
						</u-col>
					</u-row>
				</view>
			</view>
			
			<view class="" slot="body">
				<view class="wrap">
					<view v-for="(item2,index2) in item.items" :key="index2">
						<u-row>
							<u-col span="6" text-align="left">
								<view class="weikaishi4">
									线路：{{item2.lineName}}
								</view>
							</u-col>
							<u-col span="6" text-align="left">
								<view class="weikaishi4">
									公里数：{{item2.kilometer}}
								</view>
							</u-col>
						</u-row>
						<u-row>
							<u-col span="6" text-align="left">
								<view class="weikaishi4">
									总数量：{{item2.sumNum}}
								</view>
							</u-col>
							<u-col span="6" text-align="left">
								<view class="weikaishi4">
									总体积：{{item2.sumVol}}
								</view>
							</u-col>
						</u-row>
						<u-row>
							<u-col span="6" text-align="left">
								<view class="weikaishi4">
									运费：{{item2.freightMoney}}
								</view>
							</u-col>
							<u-col span="6" text-align="left">
								<view class="weikaishi4">
									装车费：{{item2.loadingMoney}}
								</view>
							</u-col>
						</u-row>
						<u-row>
							<u-col span="6" text-align="left">
								<view class="weikaishi4">
									客诉：{{item2.custComplaint}}
								</view>
							</u-col>
							<u-col span="6" text-align="left">
								<view class="weikaishi4">
									其他罚款：{{item2.otherFines}}
								</view>
							</u-col>
						</u-row>
						<u-row>
							<u-col span="6" text-align="left">
								<view class="weikaishi4">
									其他补贴：{{item2.otherSubsidie}}
								</view>
							</u-col>
							<u-col span="6" text-align="left">
								<view class="weikaishi4" style="color: red;">
									总费用：{{item2.sumMoney}}
								</view>
							</u-col>
						</u-row>
						<u-row>
							<u-col span="12" text-align="right" >
								<u-button type="success" @click="queren(item2)">确认</u-button>
							</u-col>
						</u-row>
					</view>
				</view>
			</view>
		</u-card>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList:[],
				
			}
		},
		onShow() {
			this.getDataList();
		},
		onPullDownRefresh() {
			this.getDataList();
			uni.stopPullDownRefresh()
		},
		methods: {
			getDataList(){
				uni.showLoading({
					title: '加载中...'
				})
				this.$http.post('/rest/fiCarrierFreight/list',{
				},{
					params: {
					},
					header: {
						'Authorization' :uni.getStorageSync('token'),
					}
				}).then(res => {
					console.log(res);
					uni.hideLoading()
					this.dataList = res.data
				})
			}
			,
			queren(item){
				uni.showModal({
					content: '确定已核对完成了吗？',
					success: (res) => {
						if (res.confirm) {
							uni.showLoading({
								title: '正在提交'
							})
							this.$http.post('/rest/fiCarrierFreight/updateStat',{
							},{
								params: {
									id:item.id,
									stat:"已确认"
								},
								header: {
									'Authorization' :uni.getStorageSync('token'),
								}
							}).then(res => {
								uni.hideLoading()
								console.log(res);
								if(res.data.success) {
									uni.showToast({
										title: '操作成功',
										duration: 2000
									});
									this.getDataList();
								} else {
									uni.showToast({
										title: res.data.message,
										duration: 2000,
										icon:'none',
									});
								}
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.u-body-item {
		padding: 20rpx 15rpx;
	}
	.wrap {
		padding: 0rpx 12rpx;
	}

	.u-row {
		margin: 10rpx 2rpx;
	}
	.weikaishi2{
		font-size: 34rpx;
	}
	.baise{
		background-color: #2979ff;
		color: #ffffff;
		font-size: 34rpx;
	}
	.margin-zdy{
		padding: 5rpx 20rpx 5rpx 30rpx;
		background-color: #FFFFFF;
	}
	.jiange{
		border-bottom: 1px solid #ebebeb;
	}
</style>